import JSEncrypt from "jsencrypt/bin/jsencrypt";
const _pubKey = `-----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDveATeKL/A3I5EysdDyLYV+4HP
0xwHGO4+T45Eiht25trXlG9HivFtMtHhNXb6L+2NnOKGcr9tXJPGaAl1GlO2vLgJ
8/3ueapobz2HkBOYl6kEoxwkx7J/KPxEL/DGKuGGwVTRKpotL7AOTUqAfVW6HkPc
YlJfwtwx4T1QA8BZFwIDAQAB
-----END PUBLIC KEY-----`;

export function encrypt(txt) {
    var encrypt = new JSEncrypt(); // 新建JSEncrypt对象
    encrypt.setPublicKey(_pubKey);// 设置公钥
    // 加密数据
    var res = encrypt.encrypt(txt);
    return res; // 对需要加密的数据进行加密
  }


